Fix select_rows_and_columns() silently returning a vector for single row/column selections - #77
Merged
Merged
Conversation
…row/column selections Both subset operations, df[true_rownames, ] and df[, true_colnames], were missing drop = FALSE. Base R's default drop = TRUE collapses a data.frame subset to a plain vector whenever exactly one row or one column is selected, silently changing the return type from data.frame to vector for any caller who requests a single RowID or ColID. This also broke the function's own trailing Stringendo::iprint(dim(df)) diagnostic, which prints NULL for a vector instead of the actual dimensions. Fix: add drop = FALSE to both subset operations, matching the same fix already applied to other functions in this file (combine.matrices.by.rowname.intersect, merge_numeric_df_by_rn). Verified: selecting a single column (ColIDs = "a") and a single row (RowIDs = "r1") now both correctly return a data.frame with the expected dim() printed, instead of silently degrading to a vector; the normal multi-row/multi-col case is unaffected. Version bumped 2.8.16 -> 2.8.19 (distinct from sibling PRs #75/#76, which also branch from the same 2.8.16 base and already claimed 2.8.17/2.8.18).
This was referenced Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
Both subset operations,
df[true_rownames, ]anddf[, true_colnames], were missingdrop = FALSE. Base R's defaultdrop = TRUEcollapses a data.frame subset to a plain vector whenever exactly one row or one column is selected, silently changing the return type from data.frame to vector for any caller who requests a singleRowIDorColID. This also broke the function's own trailingStringendo::iprint(dim(df))diagnostic, which printsNULLfor a vector instead of the actual dimensions.Fix
Add
drop = FALSEto both subset operations, matching the same fix already applied to other functions in this file (combine.matrices.by.rowname.intersect,merge_numeric_df_by_rn).Verification
ColIDs = "a") and a single row (RowIDs = "r1") now both correctly return a data.frame with the expecteddim()printed, instead of silently degrading to a vector.RowIDs = c("r1","r2"), ColIDs = c("a","b")).R CMD build .succeeds.2.8.16→2.8.19(distinct from sibling PRs Add missing @export to pU() #75/Fix getCategories() always returning an empty vector #76, which also branch from the same2.8.16base and already claimed2.8.17/2.8.18).R CMD check's dependency-availability step cannot complete in this sandbox due to a pre-existing, unrelated environment limitation (ReadWriter's dependencyqsfails to compile against the availablestringfishversion here) — same issue already documented on PR Fix broken \link{} in movingAve2()/imovingSEM() @title tags #71/Add missing @export to pU() #75/Fix getCategories() always returning an empty vector #76, confirmed unrelated to this change.Generated by Claude Code